<?php
/**
 * db select to connect
 *@date 2012-1-1
 *@author zhouyt
 *@version 1.0
 *@return db
 */
require_once 'Zend/Db.php';

class Db_Config {
	
	/**
	 * single instance
	 *@var Zyt_Common
	 */
	protected static $_instance = null;

	/**
	 * makes "new"
	 *@return void
	 */
	protected function __construct()
	{}

	/**
	 * makes "clone"
	 *@return void
	 */
	protected function __clone()
	{}

	/**
	 * return an instance of Zyt_Common
	 *@return an instance
	 */
	public static function getInstance()
	{
		if (null === self::$_instance) {
            self::$_instance = new self();
        }

        return self::$_instance;
	}

	/**
	 * conncect zyt_base
	 *@return db
	 */
	public function Base()
	{
		$params = array ('host'     => '127.0.0.1',
				 'username' => 'root',
				 'password' => 'root',
				 'dbname'   => 'zyt_base');

		$db = Zend_Db::factory('PDO_MYSQL', $params);
		$db->query("SET NAMES 'UTF8'");
		return $db;
	}

	/**
	 * connect member_base
	 *@return db
	 */
	public function Member()
	{
		$params = array ('host'     => '127.0.0.1',
				 'username' => 'root',
				 'password' => 'root',
				 'dbname'   => 'member_base');

		$db = Zend_Db::factory('PDO_MYSQL', $params);
		$db->query("SET NAMES 'UTF8'");
		return $db;
	}

	/**
	 * connect mall
	 *@return db
	 */
	public function Mall()
	{
		$params = array ('host'     => '127.0.0.1',
				 'username' => 'root',
				 'password' => 'root',
				 'dbname'   => 'mall');

		$db = Zend_Db::factory('PDO_MYSQL', $params);
		$db->query("SET NAMES 'UTF8'");
		return $db;
	}
}

?>